import CryptoJS from "crypto-js";
let  r = []
function n() {
  for (var e, t = 0; t < r.length; t++) {
    for (var n = r[t], o = !0, l = 1; l < n.length; l++) {
      var c = n[l];
      0 !== i[c] && (o = !1);
    }
    o && (r.splice(t--, 1), (e = a((a.s = n[0]))));
  }
  return e;
}
var w, y = n("51ff");

var k = n("53ca");
function C(e, t) {
  if (Object(k.a)(e) !== Object(k.a)(t)) return !1;
  if ("object" === Object(k.a)(e)) {
    if (e.length !== t.length) return !1;
    if (!1 === Array.isArray(e)) {
      if (
        !1 ===
        (function e(t, n) {
          var o = Object.keys(t),
            i = Object.keys(n);
          if (i.length !== o.length) return !1;
          for (var r = 0; r <= o.length - 1; r++) {
            var a = o[r];
            if (!i.includes(a)) return !1;
            if ("object" == Object(k.a)(n[a])) {
              if (!1 === Array.isArray(n[a])) {
                if (!1 === e(t[a], n[a])) return !1;
              } else if (!1 === C(t[a], n[a])) return !1;
            } else if (n[a] !== t[a]) return !1;
          }
          return !0;
        })(e, t)
      )
        return !1;
    } else for (var n in e) return C(e[n], t[n]);
  } else if (e !== t) return !1;
  return !0;
}
function v(e, t, n) {
  for (var o = t; o < e.length; o++) if (e[o] == n) return o;
  return 0;
}
const tools = {
  deleteKey: function e(t, n) {
    for (var o in t)
      o == n && delete t[n], "object" == Object(k.a)(t[o]) && e(t[o], n);
  },
  copyValue: function (e, t) {
    for (var n in e) for (var o in t) n == o && (t[o] = e[n]);
  },
  clearData: function e(t) {
    for (var n in t)
      "string" == typeof t[n] && (t[n] = ""),
        "number" == typeof t[n]
          ? (t[n] = 0)
          : "object" == Object(k.a)(t[n])
          ? 1 == Array.isArray(n)
            ? t[n].splice(0, t[n].length)
            : e(t[n])
          : "boolean" == typeof t[n] && (t[n] = !1);
  },
  getStringLength: function (e) {
    for (var t = 0, n = 0; n < e.length; n++) {
      var o = e.charCodeAt(n);
      (o >= 1 && o <= 126) || (65376 <= o && o <= 65439) ? t++ : (t += 2);
    }
    return t;
  },
  encrypt: function (e) {
    var t = CryptoJS.enc.Utf8.parse("abcdefghijklmn12"),
      n = CryptoJS.enc.Utf8.parse(e);
    return CryptoJS.AES.encrypt(n, t, {
      mode: CryptoJS.mode.ECB,
      padding: CryptoJS.pad.Pkcs7,
    }).toString();
  },
  decrypt: function (e) {
    var t = CryptoJS.enc.Utf8.parse("abcdefghijklmn12"),
      n = CryptoJS.AES.decrypt(e, t, {
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7,
      });
    return CryptoJS.enc.Utf8.stringify(n).toString();
  },
  isNull: function (e) {
    var t = !1;
    return (
      void 0 === e && (t = !0),
      ("" !== e && "" !== e) || (t = !0),
      null === e && (t = !0),
      t
    );
  },
  diffData: C,
  editComma: function (e, t, n) {
    if (Array.isArray(e))
      if ("end" == t) {
        if ("int" != n) {
          for (var o = "'", i = 0; i < e[0].length; i++) o += e[0][i] + "','";
          return [o.slice(0, o.length - 2)];
        }
        var r = e[0].slice(0);
        if (Array.isArray(e[0])) return e[0].splice(0), [r.join(",")];
      } else if ("begin" == t)
        return (
          "string" == typeof e[0]
            ? ((e[0] = e[0].replace(/\'/g, "")), (e[0] = e[0].split(",")))
            : 1 == Array.isArray(e[0]) &&
              ((r = e[0].slice()), e[0].splice(0), (e[0] = [r])),
          e
        );
  },
  getTextWidth: function (e, t) {
    var n,
      o = document.createElement("span");
    return (
      (o.innerText = e),
      (o.style.fontSize = t),
      (o.style.fontFamily = "MicrosoftYaHei"),
      (o.style.fontWeight = "400"),
      document.documentElement.append(o),
      (n = o.offsetWidth.toFixed(2)),
      document.documentElement.removeChild(o),
      n
    );
  },
  selectStr: function (e, t) {
    var n = [],
      o = e.indexOf(t);
    if (o < 0) return !1;
    do {
      n.push(o), (o = (e = e.replace(e[o], "A")).indexOf(t));
    } while (o > 0);
    return n;
  },
  getFunction: function (e, t, n) {
    for (var o = [], i = 0, r = 0; r < e.length; r++)
      e[r] == t &&
        ((i = v(e, r + 1, n)),
        o.push({
          startIndex: r,
          endIndex: i + 1,
        }));
    return o;
  },
  findNear: v,
};
export { tools };
